package com.fafu.control;

import com.fafu.pojo.MessageAndPics;
import com.fafu.service.PageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import util.Dictionary;
import util.JsonRsp;
import util.MyMap;

import java.util.Map;

@Api("page")
@RestController
@RequestMapping("/page")
public class PageControl {
    private Logger logger =LoggerFactory.getLogger(PageControl.class);
    @Autowired
    private PageService pageService;
    @ApiOperation("获取url")
    @RequestMapping(value = "/getUrl",method = RequestMethod.POST)
    public JsonRsp getUrl(
            @RequestParam(value = "oid") @ApiParam(value = "管理员id")Integer oid){
        try{
            Map<String,Object> reMap = pageService.getPageList(new MyMap().put("oid",oid).toMap());
            return JsonRsp.success(reMap.get("data"));
        }catch (Exception e){
            logger.error("系统内部错误"+e);
            return JsonRsp.fail(Dictionary.CODE.SYSTEM_ERROR,"系统内部错误");
        }

    }

}
